Effect of UPSTM-Based
Decorrelation on Feature Discovery
Loading the
libraries
library("FRESA.CAD")
library(readxl)
library(igraph)
library(umap)
library(tsne)
library(entropy)
op <- par(no.readonly = TRUE)
pander::panderOptions('digits', 3)
pander::panderOptions('table.split.table', 400)
pander::panderOptions('keep.trailing.zeros',TRUE)
Material and
Methods
Data from the speech features
The Data
pd_speech_features <- as.data.frame(read_excel("~/GitHub/FCA/Data/pd_speech_features.xlsx",sheet = "pd_speech_features", range = "A2:ACB758"))
The Average of the
Three Repetitions
Each subject had three repeated observations. Here I’ll use the
average of the three experiments per subject.
rep1Parkison <- subset(pd_speech_features,RID==1)
rownames(rep1Parkison) <- rep1Parkison$id
rep1Parkison$id <- NULL
rep1Parkison$RID <- NULL
rep1Parkison[,1:ncol(rep1Parkison)] <- sapply(rep1Parkison,as.numeric)
rep2Parkison <- subset(pd_speech_features,RID==2)
rownames(rep2Parkison) <- rep2Parkison$id
rep2Parkison$id <- NULL
rep2Parkison$RID <- NULL
rep2Parkison[,1:ncol(rep2Parkison)] <- sapply(rep2Parkison,as.numeric)
rep3Parkison <- subset(pd_speech_features,RID==3)
rownames(rep3Parkison) <- rep3Parkison$id
rep3Parkison$id <- NULL
rep3Parkison$RID <- NULL
rep3Parkison[,1:ncol(rep3Parkison)] <- sapply(rep3Parkison,as.numeric)
whof <- !(colnames(rep1Parkison) %in% c("gender","class"));
avgParkison <- rep1Parkison;
avgParkison[,whof] <- (rep1Parkison[,whof] + rep2Parkison[,whof] + rep3Parkison[,whof])/3
signedlog <- function(x) { return (sign(x)*log(abs(1.0e12*x)+1.0))}
whof <- !(colnames(avgParkison) %in% c("gender","class"));
avgParkison[,whof] <- signedlog(avgParkison[,whof])
Standarize the
names for the reporting
studyName <- "Parkinsons"
dataframe <- avgParkison
outcome <- "class"
TopVariables <- 10
thro <- 0.80
cexheat = 0.15
Generaring the
report
Libraries
Some libraries
library(psych)
library(whitening)
library("vioplot")
library("rpart")
Data specs
pander::pander(c(rows=nrow(dataframe),col=ncol(dataframe)-1))
pander::pander(table(dataframe[,outcome]))
varlist <- colnames(dataframe)
varlist <- varlist[varlist != outcome]
largeSet <- length(varlist) > 1500
Scaling the
data
Scaling and removing near zero variance columns and highly
co-linear(r>0.99999) columns
### Some global cleaning
sdiszero <- apply(dataframe,2,sd) > 1.0e-16
dataframe <- dataframe[,sdiszero]
varlist <- colnames(dataframe)[colnames(dataframe) != outcome]
tokeep <- c(as.character(correlated_Remove(dataframe,varlist,thr=0.99999)),outcome)
dataframe <- dataframe[,tokeep]
varlist <- colnames(dataframe)
varlist <- varlist[varlist != outcome]
iscontinous <- sapply(apply(dataframe,2,unique),length) >= 5 ## Only variables with enough samples
dataframeScaled <- FRESAScale(dataframe,method="OrderLogit")$scaledData
The heatmap of the
data
numsub <- nrow(dataframe)
if (numsub > 1000) numsub <- 1000
if (!largeSet)
{
hm <- heatMaps(data=dataframeScaled[1:numsub,],
Outcome=outcome,
Scale=TRUE,
hCluster = "row",
xlab="Feature",
ylab="Sample",
srtCol=45,
srtRow=45,
cexCol=cexheat,
cexRow=cexheat
)
par(op)
}

Correlation
Matrix of the Data
The heat map of the data
if (!largeSet)
{
par(cex=0.6,cex.main=0.85,cex.axis=0.7)
#cormat <- Rfast::cora(as.matrix(dataframe[,varlist]),large=TRUE)
cormat <- cor(dataframe[,varlist],method="pearson")
cormat[is.na(cormat)] <- 0
gplots::heatmap.2(abs(cormat),
trace = "none",
# scale = "row",
mar = c(5,5),
col=rev(heat.colors(5)),
main = "Original Correlation",
cexRow = cexheat,
cexCol = cexheat,
srtCol=45,
srtRow=45,
key.title=NA,
key.xlab="|Pearson Correlation|",
xlab="Feature", ylab="Feature")
diag(cormat) <- 0
print(max(abs(cormat)))
}
[1]
0.9999951
The
decorrelation
DEdataframe <- IDeA(dataframe,verbose=TRUE,thr=thro)
#>
#> Included: 744 , Uni p: 0.01657441 , Uncorrelated Base: 192 , Outcome-Driven Size: 0 , Base Size: 192
#>
#>
1 <R=1.000,r=0.975,N= 363>, Top: 78( 2 )[ 1 : 78 Fa= 77 : 0.975 ]( 77 , 204 , 0 ),<|>Tot Used: 281 , Added: 204 , Zero Std: 0 , Max Cor: 1.000
#>
2 <R=1.000,r=0.975,N= 363>, Top: 20( 4 )[ 1 : 20 Fa= 96 : 0.975 ]( 20 , 59 , 77 ),<|>Tot Used: 334 , Added: 59 , Zero Std: 0 , Max Cor: 1.000
#>
3 <R=1.000,r=0.975,N= 363>, Top: 12( 1 )[ 1 : 12 Fa= 108 : 0.975 ]( 12 , 21 , 96 ),<|>Tot Used: 349 , Added: 21 , Zero Std: 0 , Max Cor: 1.000
#>
4 <R=1.000,r=0.950,N= 195>, Top: 73( 5 )[ 1 : 73 Fa= 144 : 0.950 ]( 72 , 94 , 108 ),<|>Tot Used: 417 , Added: 94 , Zero Std: 0 , Max Cor: 0.991
#>
5 <R=0.991,r=0.945,N= 195>, Top: 23( 1 )[ 1 : 23 Fa= 153 : 0.945 ]( 23 , 27 , 144 ),<|>Tot Used: 426 , Added: 27 , Zero Std: 0 , Max Cor: 0.965
#>
6 <R=0.965,r=0.932,N= 195>, Top: 30( 1 )[ 1 : 30 Fa= 161 : 0.932 ]( 30 , 37 , 153 ),<|>Tot Used: 442 , Added: 37 , Zero Std: 0 , Max Cor: 0.950
#>
7 <R=0.950,r=0.925,N= 195>, Top: 13( 1 )[ 1 : 13 Fa= 166 : 0.925 ]( 13 , 13 , 161 ),<|>Tot Used: 448 , Added: 13 , Zero Std: 0 , Max Cor: 0.924
#>
8 <R=0.924,r=0.862,N= 173>, Top: 63( 2 )[ 1 : 63 Fa= 189 : 0.862 ]( 62 , 85 , 166 ),<|>Tot Used: 478 , Added: 85 , Zero Std: 0 , Max Cor: 0.981
#>
9 <R=0.981,r=0.891,N= 173>, Top: 7( 1 )[ 1 : 7 Fa= 192 : 0.891 ]( 7 , 7 , 189 ),<|>Tot Used: 481 , Added: 7 , Zero Std: 0 , Max Cor: 0.890
#>
10 <R=0.890,r=0.800,N= 180>, Top: 62( 6 )[ 1 : 62 Fa= 210 : 0.800 ]( 59 , 91 , 192 ),<|>Tot Used: 507 , Added: 91 , Zero Std: 0 , Max Cor: 0.930
#>
11 <R=0.930,r=0.815,N= 180>, Top: 12( 1 )[ 1 : 12 Fa= 215 : 0.815 ]( 12 , 14 , 210 ),<|>Tot Used: 511 , Added: 14 , Zero Std: 0 , Max Cor: 0.914
#>
12 <R=0.914,r=0.800,N= 9>, Top: 4( 1 )[ 1 : 4 Fa= 216 : 0.800 ]( 4 , 5 , 215 ),<|>Tot Used: 511 , Added: 5 , Zero Std: 0 , Max Cor: 0.799
#>
13 <R=0.799,r=0.800,N= 9>
#>
[ 13 ], 0.7994489 Decor Dimension: 511 Nused: 511 . Cor to Base: 133 , ABase: 11 , Outcome Base: 0
#>
varlistc <- colnames(DEdataframe)[colnames(DEdataframe) != outcome]
pander::pander(sum(apply(dataframe[,varlist],2,var)))
57178
pander::pander(sum(apply(DEdataframe[,varlistc],2,var)))
55983
pander::pander(entropy(discretize(unlist(dataframe[,varlist]), 256)))
4.68
pander::pander(entropy(discretize(unlist(DEdataframe[,varlistc]), 256)))
2.45
The decorrelation
matrix
if (!largeSet)
{
par(cex=0.6,cex.main=0.85,cex.axis=0.7)
UPSTM <- attr(DEdataframe,"UPSTM")
gplots::heatmap.2(1.0*(abs(UPSTM)>0),
trace = "none",
mar = c(5,5),
col=rev(heat.colors(5)),
main = "Decorrelation matrix",
cexRow = cexheat,
cexCol = cexheat,
srtCol=45,
srtRow=45,
key.title=NA,
key.xlab="|Beta|>0",
xlab="Output Feature", ylab="Input Feature")
par(op)
}

The correlation
matrix after decorrelation
if (!largeSet)
{
cormat <- cor(DEdataframe[,varlistc],method="pearson")
cormat[is.na(cormat)] <- 0
gplots::heatmap.2(abs(cormat),
trace = "none",
mar = c(5,5),
col=rev(heat.colors(5)),
main = "Correlation after IDeA",
cexRow = cexheat,
cexCol = cexheat,
srtCol=45,
srtRow=45,
key.title=NA,
key.xlab="|Pearson Correlation|",
xlab="Feature", ylab="Feature")
par(op)
diag(cormat) <- 0
print(max(abs(cormat)))
}
[1]
0.7994489
U-MAP Visualization
of features
The UMAP based on
LASSO on Raw Data
if (nrow(dataframe) < 1000)
{
classes <- unique(dataframe[1:numsub,outcome])
raincolors <- rainbow(length(classes))
names(raincolors) <- classes
datasetframe.umap = umap(scale(dataframe[1:numsub,varlist]),n_components=2)
plot(datasetframe.umap$layout,xlab="U1",ylab="U2",main="UMAP: Original",t='n')
text(datasetframe.umap$layout,labels=dataframe[1:numsub,outcome],col=raincolors[dataframe[1:numsub,outcome]+1])
}

The decorralted
UMAP
if (nrow(dataframe) < 1000)
{
datasetframe.umap = umap(scale(DEdataframe[1:numsub,varlistc]),n_components=2)
plot(datasetframe.umap$layout,xlab="U1",ylab="U2",main="UMAP: After IDeA",t='n')
text(datasetframe.umap$layout,labels=DEdataframe[1:numsub,outcome],col=raincolors[DEdataframe[1:numsub,outcome]+1])
}

Univariate
Analysis
Univariate
univarRAW <- uniRankVar(varlist,
paste(outcome,"~1"),
outcome,
dataframe,
rankingTest="AUC")
100 : std_MFCC_2nd_coef 200 : app_entropy_log_3_coef 300 :
app_LT_TKEO_mean_7_coef 400 : tqwt_entropy_log_dec_15 500 :
tqwt_medianValue_dec_7
600 : tqwt_stdValue_dec_35 700 : tqwt_skewnessValue_dec_27
univarDe <- uniRankVar(varlistc,
paste(outcome,"~1"),
outcome,
DEdataframe,
rankingTest="AUC",
)
100 : std_MFCC_2nd_coef 200 : La_app_entropy_log_3_coef 300 :
La_app_LT_TKEO_mean_7_coef 400 : La_tqwt_entropy_log_dec_15 500 :
tqwt_medianValue_dec_7
600 : La_tqwt_stdValue_dec_35 700 : tqwt_skewnessValue_dec_27
Final Table
univariate_columns <- c("caseMean","caseStd","controlMean","controlStd","controlKSP","ROCAUC")
##top variables
topvar <- c(1:length(varlist)) <= TopVariables
tableRaw <- univarRAW$orderframe[topvar,univariate_columns]
pander::pander(tableRaw)
| std_delta_delta_log_energy |
23.4 |
0.469 |
22.8 |
0.461 |
0.653 |
0.798 |
| std_delta_log_energy |
24.3 |
0.477 |
23.8 |
0.441 |
0.634 |
0.794 |
| std_9th_delta_delta |
23.6 |
0.242 |
23.4 |
0.171 |
0.746 |
0.787 |
| std_8th_delta_delta |
23.7 |
0.240 |
23.4 |
0.150 |
0.725 |
0.780 |
| std_7th_delta_delta |
23.7 |
0.261 |
23.5 |
0.188 |
0.931 |
0.776 |
| tqwt_entropy_log_dec_12 |
-39.6 |
0.239 |
-39.4 |
0.240 |
0.887 |
0.770 |
| std_6th_delta_delta |
23.8 |
0.277 |
23.5 |
0.172 |
0.945 |
0.768 |
| std_8th_delta |
24.4 |
0.245 |
24.2 |
0.163 |
0.981 |
0.767 |
| std_9th_delta |
24.4 |
0.249 |
24.1 |
0.185 |
0.398 |
0.764 |
| tqwt_entropy_shannon_dec_12 |
30.3 |
1.993 |
32.1 |
1.703 |
0.196 |
0.763 |
topLAvar <- univarDe$orderframe$Name[str_detect(univarDe$orderframe$Name,"La_")]
topLAvar <- unique(c(univarDe$orderframe$Name[topvar],topLAvar[1:as.integer(TopVariables/2)]))
finalTable <- univarDe$orderframe[topLAvar,univariate_columns]
pander::pander(finalTable)
| std_delta_log_energy |
24.335 |
0.477 |
23.810 |
0.441 |
6.34e-01 |
0.794 |
| std_8th_delta_delta |
23.660 |
0.240 |
23.428 |
0.150 |
7.25e-01 |
0.780 |
| tqwt_entropy_log_dec_12 |
-39.634 |
0.239 |
-39.390 |
0.240 |
8.87e-01 |
0.770 |
| La_tqwt_entropy_log_dec_28 |
-0.633 |
0.430 |
-0.819 |
0.273 |
1.25e-07 |
0.758 |
| La_std_2nd_delta |
0.462 |
0.132 |
0.329 |
0.144 |
7.54e-01 |
0.754 |
| mean_MFCC_2nd_coef |
21.360 |
18.112 |
1.716 |
27.881 |
4.61e-07 |
0.753 |
| La_tqwt_energy_dec_33 |
0.745 |
0.372 |
1.217 |
0.680 |
8.01e-01 |
0.736 |
| La_tqwt_kurtosisValue_dec_33 |
6.360 |
0.407 |
5.975 |
0.553 |
1.62e-01 |
0.736 |
| tqwt_kurtosisValue_dec_18 |
28.598 |
0.288 |
28.395 |
0.144 |
9.92e-01 |
0.734 |
| La_apq11Shimmer |
2.150 |
0.161 |
2.031 |
0.133 |
4.19e-01 |
0.734 |
dc <- getLatentCoefficients(DEdataframe)
fscores <- attr(DEdataframe,"fscore")
pander::pander(c(mean=mean(sapply(dc,length)),total=length(dc),fraction=length(dc)/(ncol(dataframe)-1)))
theCharformulas <- attr(dc,"LatentCharFormulas")
finalTable <- rbind(finalTable,tableRaw[topvar[!(topvar %in% topLAvar)],univariate_columns])
orgnamez <- rownames(finalTable)
orgnamez <- str_remove_all(orgnamez,"La_")
finalTable$RAWAUC <- univarRAW$orderframe[orgnamez,"ROCAUC"]
finalTable$DecorFormula <- theCharformulas[rownames(finalTable)]
finalTable$fscores <- fscores[rownames(finalTable)]
Final_Columns <- c("DecorFormula","caseMean","caseStd","controlMean","controlStd","controlKSP","ROCAUC","RAWAUC","fscores")
finalTable <- finalTable[order(-finalTable$ROCAUC),]
pander::pander(finalTable[,Final_Columns])
| std_delta_delta_log_energy |
NA |
23.357 |
0.469 |
22.794 |
0.461 |
6.53e-01 |
0.798 |
0.798 |
NA |
| std_delta_log_energy |
NA |
24.335 |
0.477 |
23.810 |
0.441 |
6.34e-01 |
0.794 |
0.794 |
2 |
| std_delta_log_energy1 |
NA |
24.335 |
0.477 |
23.810 |
0.441 |
6.34e-01 |
0.794 |
NA |
NA |
| std_9th_delta_delta |
NA |
23.630 |
0.242 |
23.388 |
0.171 |
7.46e-01 |
0.787 |
0.787 |
NA |
| std_8th_delta_delta |
NA |
23.660 |
0.240 |
23.428 |
0.150 |
7.25e-01 |
0.780 |
0.780 |
6 |
| std_8th_delta_delta1 |
NA |
23.660 |
0.240 |
23.428 |
0.150 |
7.25e-01 |
0.780 |
NA |
NA |
| std_7th_delta_delta |
NA |
23.732 |
0.261 |
23.479 |
0.188 |
9.31e-01 |
0.776 |
0.776 |
NA |
| tqwt_entropy_log_dec_12 |
NA |
-39.634 |
0.239 |
-39.390 |
0.240 |
8.87e-01 |
0.770 |
0.770 |
NA |
| tqwt_entropy_log_dec_121 |
NA |
-39.634 |
0.239 |
-39.390 |
0.240 |
8.87e-01 |
0.770 |
NA |
NA |
| std_6th_delta_delta |
NA |
23.800 |
0.277 |
23.548 |
0.172 |
9.45e-01 |
0.768 |
0.768 |
NA |
| std_8th_delta |
NA |
24.406 |
0.245 |
24.175 |
0.163 |
9.81e-01 |
0.767 |
0.767 |
NA |
| std_9th_delta |
NA |
24.365 |
0.249 |
24.134 |
0.185 |
3.98e-01 |
0.764 |
0.764 |
NA |
| tqwt_entropy_shannon_dec_12 |
NA |
30.301 |
1.993 |
32.106 |
1.703 |
1.96e-01 |
0.763 |
0.763 |
NA |
| La_tqwt_entropy_log_dec_28 |
+ tqwt_entropy_log_dec_28 -
(0.981)tqwt_entropy_log_dec_29 |
-0.633 |
0.430 |
-0.819 |
0.273 |
1.25e-07 |
0.758 |
0.654 |
-1 |
| La_std_2nd_delta |
- (0.907)std_MFCC_2nd_coef + std_2nd_delta |
0.462 |
0.132 |
0.329 |
0.144 |
7.54e-01 |
0.754 |
0.630 |
0 |
| mean_MFCC_2nd_coef |
NA |
21.360 |
18.112 |
1.716 |
27.881 |
4.61e-07 |
0.753 |
0.753 |
NA |
| La_tqwt_energy_dec_33 |
- (0.919)tqwt_energy_dec_32 + tqwt_energy_dec_33 |
0.745 |
0.372 |
1.217 |
0.680 |
8.01e-01 |
0.736 |
0.509 |
1 |
| La_tqwt_kurtosisValue_dec_33 |
- (0.788)tqwt_kurtosisValue_dec_31 +
tqwt_kurtosisValue_dec_33 |
6.360 |
0.407 |
5.975 |
0.553 |
1.62e-01 |
0.736 |
0.628 |
-1 |
| tqwt_kurtosisValue_dec_18 |
NA |
28.598 |
0.288 |
28.395 |
0.144 |
9.92e-01 |
0.734 |
0.734 |
3 |
| La_apq11Shimmer |
- (0.907)locShimmer + apq11Shimmer |
2.150 |
0.161 |
2.031 |
0.133 |
4.19e-01 |
0.734 |
0.713 |
-1 |
Comparing IDeA vs
PCA vs EFA
PCA
featuresnames <- colnames(dataframe)[colnames(dataframe) != outcome]
pc <- prcomp(dataframe[,iscontinous],center = TRUE,scale. = TRUE) #principal components
predPCA <- predict(pc,dataframe[,iscontinous])
PCAdataframe <- as.data.frame(cbind(predPCA,dataframe[,!iscontinous]))
colnames(PCAdataframe) <- c(colnames(predPCA),colnames(dataframe)[!iscontinous])
#plot(PCAdataframe[,colnames(PCAdataframe)!=outcome],col=dataframe[,outcome],cex=0.65,cex.lab=0.5,cex.axis=0.75,cex.sub=0.5,cex.main=0.75)
#pander::pander(pc$rotation)
PCACor <- cor(PCAdataframe[,colnames(PCAdataframe) != outcome])
gplots::heatmap.2(abs(PCACor),
trace = "none",
# scale = "row",
mar = c(5,5),
col=rev(heat.colors(5)),
main = "PCA Correlation",
cexRow = 0.5,
cexCol = 0.5,
srtCol=45,
srtRow= -45,
key.title=NA,
key.xlab="Pearson Correlation",
xlab="Feature", ylab="Feature")

EFA
EFAdataframe <- dataframeScaled
if (length(iscontinous) < 2000)
{
topred <- min(length(iscontinous),nrow(dataframeScaled),ncol(predPCA)/2)
if (topred < 2) topred <- 2
uls <- fa(dataframeScaled[,iscontinous],nfactors=topred,rotate="varimax",warnings=FALSE) # EFA analysis
predEFA <- predict(uls,dataframeScaled[,iscontinous])
EFAdataframe <- as.data.frame(cbind(predEFA,dataframeScaled[,!iscontinous]))
colnames(EFAdataframe) <- c(colnames(predEFA),colnames(dataframeScaled)[!iscontinous])
EFACor <- cor(EFAdataframe[,colnames(EFAdataframe) != outcome])
gplots::heatmap.2(abs(EFACor),
trace = "none",
# scale = "row",
mar = c(5,5),
col=rev(heat.colors(5)),
main = "EFA Correlation",
cexRow = 0.5,
cexCol = 0.5,
srtCol=45,
srtRow= -45,
key.title=NA,
key.xlab="Pearson Correlation",
xlab="Feature", ylab="Feature")
}

Effect on CAR
modeling
par(op)
par(xpd = TRUE)
dataframe[,outcome] <- factor(dataframe[,outcome])
rawmodel <- rpart(paste(outcome,"~."),dataframe,control=rpart.control(maxdepth=3))
pr <- predict(rawmodel,dataframe,type = "class")
ptab <- list(er="Error",detail=matrix(nrow=6,ncol=1))
if (length(unique(pr))>1)
{
plot(rawmodel,main="Raw",branch=0.5,uniform = TRUE,compress = TRUE,margin=0.1)
text(rawmodel, use.n = TRUE,cex=0.75)
ptab <- epiR::epi.tests(table(pr==0,dataframe[,outcome]==0))
}

pander::pander(table(dataframe[,outcome],pr))
pander::pander(ptab$detail[c(5,3,4,6),])
| 5 |
diag.ac |
0.889 |
0.843 |
0.925 |
| 3 |
se |
0.984 |
0.954 |
0.997 |
| 4 |
sp |
0.609 |
0.479 |
0.729 |
| 6 |
diag.or |
96.200 |
27.662 |
334.550 |
par(op)
par(xpd = TRUE)
DEdataframe[,outcome] <- factor(DEdataframe[,outcome])
IDeAmodel <- rpart(paste(outcome,"~."),DEdataframe,control=rpart.control(maxdepth=3))
pr <- predict(IDeAmodel,DEdataframe,type = "class")
ptab <- list(er="Error",detail=matrix(nrow=6,ncol=1))
if (length(unique(pr))>1)
{
plot(IDeAmodel,main="IDeA",branch=0.5,uniform = TRUE,compress = TRUE,margin=0.1)
text(IDeAmodel, use.n = TRUE,cex=0.75)
ptab <- epiR::epi.tests(table(pr==0,DEdataframe[,outcome]==0))
}

pander::pander(table(DEdataframe[,outcome],pr))
pander::pander(ptab$detail[c(5,3,4,6),])
| 5 |
diag.ac |
0.905 |
0.862 |
0.938 |
| 3 |
se |
0.968 |
0.932 |
0.988 |
| 4 |
sp |
0.719 |
0.592 |
0.824 |
| 6 |
diag.or |
77.519 |
29.125 |
206.321 |
par(op)
par(xpd = TRUE)
PCAdataframe[,outcome] <- factor(PCAdataframe[,outcome])
PCAmodel <- rpart(paste(outcome,"~."),PCAdataframe,control=rpart.control(maxdepth=3))
pr <- predict(PCAmodel,PCAdataframe,type = "class")
ptab <- list(er="Error",detail=matrix(nrow=6,ncol=1))
if (length(unique(pr))>1)
{
plot(PCAmodel,main="PCA",branch=0.5,uniform = TRUE,compress = TRUE,margin=0.1)
text(PCAmodel, use.n = TRUE,cex=0.75)
ptab <- epiR::epi.tests(table(pr==0,PCAdataframe[,outcome]==0))
}

pander::pander(table(PCAdataframe[,outcome],pr))
pander::pander(ptab$detail[c(5,3,4,6),])
| 5 |
diag.ac |
0.849 |
0.799 |
0.891 |
| 3 |
se |
0.926 |
0.878 |
0.959 |
| 4 |
sp |
0.625 |
0.495 |
0.743 |
| 6 |
diag.or |
20.714 |
9.850 |
43.561 |
par(op)
EFA
EFAdataframe[,outcome] <- factor(EFAdataframe[,outcome])
EFAmodel <- rpart(paste(outcome,"~."),EFAdataframe,control=rpart.control(maxdepth=3))
pr <- predict(EFAmodel,EFAdataframe,type = "class")
ptab <- list(er="Error",detail=matrix(nrow=6,ncol=1))
if (length(unique(pr))>1)
{
plot(EFAmodel,main="EFA",branch=0.5,uniform = TRUE,compress = TRUE,margin=0.1)
text(EFAmodel, use.n = TRUE,cex=0.75)
ptab <- epiR::epi.tests(table(pr==0,EFAdataframe[,outcome]==0))
}

pander::pander(table(EFAdataframe[,outcome],pr))
pander::pander(ptab$detail[c(5,3,4,6),])
| 5 |
diag.ac |
0.873 |
0.825 |
0.911 |
| 3 |
se |
0.979 |
0.946 |
0.994 |
| 4 |
sp |
0.562 |
0.433 |
0.686 |
| 6 |
diag.or |
59.143 |
19.552 |
178.898 |
par(op)